@app.route('/usercenter/')def usercenter(user_id): user = User.query.filter(User.id == user_id).first() context = { 'username_id': user.id, 'username': user.username, 'wenda': user.wenda, 'comments': user.comment } return render_template('usercenter.html',**context)@app.route('/userquestion/ ')def userquestion(user_id): user = User.query.filter(User.id == user_id).first() context = { 'username_id': user.id, 'username': user.username, 'wenda': user.wenda, 'comments': user.comment } return render_template('userquestion.html',**context)@app.route('/usercomment/ ')def usercomment(user_id): user = User.query.filter(User.id == user_id).first() context = { 'username_id': user.id, 'username': user.username, 'wenda': user.wenda, 'comments': user.comment } return render_template('usercomment.html',**context)if __name__ == '__main__': app.run(debug=True)
{% extends 'user.html' %}{ % block user %}{ % endblock %}{ { username }}
个人信息
- 用户:{ { username }}
- 昵称
- 文章篇数:{ { wenda|length }}
{% extends "user.html" %}{ % block user %}{% for foo in wenda %} { % endfor %}{ % endblock %}
{% extends "user.html" %}{ % block user %}{% for foo in comments %}{ % endblock %}{ { foo.author.username }} { { foo.create_time }} { % endfor %}{
{ foo.detail }}